package com.i5tong.epubreader;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.i5tong.epubreaderlib.ui.EpubReaderActivity;


public class MainActivity extends FragmentActivity {

    private EditText et_EpubUrl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        et_EpubUrl = (EditText) findViewById(R.id.epub_url);
    }

    public void ReadEpub(View v) {
        if (et_EpubUrl.getText().length() == 0) {
            Toast.makeText(this, "epub网址不正确", Toast.LENGTH_LONG).show();
            return;
        }

        startActivity(new Intent(this, EpubReaderActivity.class)
                .putExtra("cacheFolder", Environment.getExternalStorageDirectory() + "/epub/")
                .putExtra("epubUrl", et_EpubUrl.getText().toString())
                .putExtra("bookTitle", "楚留香系列"));
    }
}
